package com.example.design_pattern.visitor;

public class PriceVisitor implements Visitor {

    private double mTotalPrice;


    @Override
    public void visitCpu(Cpu cpu) {
        mTotalPrice += cpu.price();
    }

    @Override
    public void visitCase(Case mCase) {
        mTotalPrice += mCase.price();
    }

    @Override
    public void visitHardDisk(HardDisk hardDisk) {
        mTotalPrice += hardDisk.price();
    }

    @Override
    public void visitMainBoard(MainBoard mainBoard) {
        mTotalPrice += mainBoard.price();
    }

    @Override
    public void visitPc(Pc pc) {
        mTotalPrice += pc.price();
    }

    @Override
    public void visitIntegratedBoard(IntegratedBoard integratedBoard) {
        mTotalPrice += integratedBoard.price();
    }

    public double retrieveTotalPrice(){
        return mTotalPrice;
    }
}
